package com.cloudbroker.bcs.platform.ltb.middle.service.impl;

import com.alibaba.fastjson.JSON;
import com.cloudbroker.bcs.common.dao.base.DAOBase;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.admin.vo.BlackKeyWordForm;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.admin.vo.BlackUserForm;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.admin.vo.CommentQueryForm;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.comment.vo.CommentSearchForm;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.comment.vo.CommentTargetForm;
import com.cloudbroker.bcs.platform.ltb.middle.dao.*;
import com.cloudbroker.bcs.platform.ltb.middle.entity.BlackUser;
import com.cloudbroker.bcs.platform.ltb.middle.entity.BlackWord;
import com.cloudbroker.bcs.platform.ltb.middle.entity.CommentMsg;
import com.cloudbroker.bcs.platform.ltb.middle.entity.CommentUser;
import com.cloudbroker.bcs.platform.ltb.middle.service.CommentService;
import com.cloudbroker.bcs.platform.ltb.middle.service.base.TenantServiceImplBase;
//import com.cloudbroker.bcs.platform.ltb.middle.util.StringReplacer;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by zhaosh19213 on 2016/7/15.
 */
@Service
public class CommentServiceImpl extends TenantServiceImplBase<CommentMsg,String> implements CommentService {

    @Resource
    private CommentDAO commentDAO;


    @Resource
    private CustomerDAO customerDAO;


    @Override
    protected DAOBase<CommentMsg, String> getDAO() {
        return commentDAO;
    }


    public int getMaxTopNum() {
        return commentDAO.getMaxTopNum();
    }

    @Override
    public int topComment(CommentMsg commentMsg) {
        return commentDAO.topComment(commentMsg);
    }

    @Override
    public int updateComment(CommentMsg commentMsg) {
        return  commentDAO.updateComment(commentMsg);
    }

    public List<CommentUser> queryComments(CommentQueryForm commentQueryForm){
        return commentDAO.queryComments(commentQueryForm);
    }

    public List<CommentUser> queryCommentsByTarget(CommentTargetForm targetForm){
        List<CommentUser> commentUsers = commentDAO.queryCommentsByTarget(targetForm);
        return commentUsers;

    }

    public List<CommentUser> queryCommentsByIds(List<Long> commentIds){
        return commentDAO.queryCommentsByIds(commentIds);
    }


    @Override
    public List<CommentUser> searchComments(CommentSearchForm commentSearchForm){
        return commentDAO.searchComments(commentSearchForm);
    }

    @Override
    public void cancelTopByTargetId(CommentMsg commentMsg) {
        commentDAO.cancelTopByTargetId(commentMsg);

    }

    @Override
    public int countByTargetId(CommentTargetForm targetForm) {
        return commentDAO.countCommentsByTarget(targetForm);
    }
}
